><

About back-references in wildcard searches



Back-references let you replace without specifying text. They appear as wildcard strings in the Replace text box, from which they refer back to any string that matches a part of the search pattern.

A back-reference consists of a backslash character followed by a number, for example "\1", "\2", and so on. The number refers to a subexpression (enclosed in parentheses) of the wildcard search pattern in the Find text box:

  • "\1" refers to the first subexpression in the wildcard search pattern. This subexpression starts at the first opening bracket from the left and ends with the complementary closing bracket.
  • "\2" refers to the second subexpression, which starts at the second opening bracket from the left and ends with the complementary closing bracket.

  • When you click the Replace button, each back-reference is replaced with the part of the matching text that has been recognized by the subexpression it refers to.

    For example, you enter ((Adobe )?GoLive) in the Find text box. This search patterns finds any occurrence of "Adobe GoLive" or "GoLive". (The "?" character makes the "Adobe" enclosed in the second pair of parentheses optional.) You enter the wildcard pattern \1 5.0 in the Replace text box: If the match is "Adobe GoLive", the result is Adobe GoLive 5.0 If the match is "GoLive", the result is GoLive 5.0.


    Searching > Searching within a document and within a site > About back-references in wildcard searches